package com.zznj.xzjc.adapter.index;

import android.text.Html;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;
import com.zznj.xzjc.bean.index.AlkData;
import com.zznj.xzjc.bean.index.SadsrData;
import com.zznj.xzjc.utils.StringUtils;
import com.zznj.xzjc.utils.TimeUtils;

import java.util.HashMap;
import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class AlkAdapter extends BaseQuickAdapter<AlkData, BaseViewHolder> {

    public AlkAdapter(int layoutResId, @Nullable List<AlkData> data) {
        super(layoutResId, data);
    }

    private String key;
    public void setKey(String key){
        this.key = key;
        notifyDataSetChanged();
    }

    private HashMap<Integer, String> hjMap = new HashMap<Integer, String>() {{
        put(0, "行政受理"); put(29, "已做出行政处罚，已结案");
        put(1, "行政立案");
        put(3, "行政不立案");
        put(2, "行政处罚");
        put(38, "行政复议");
        put(4, "行政撤案");
        put(39, "催告");
        put(40, "行政执行");
        put(42, "申请强制执行");
        put(41, "撤回强制执行");
        put(51, "结案");
        put(53, "法院受理");
        put(52, "法院不予受理");
        put(43, "法院立案");
        put(44, "法院不予立案");
        put(56, "裁定准予撤回执行");
        put(45, "裁定准予执行");
        put(46, "裁定不予执行");
        put(47, "终结本次执行");
        put(54, "终结执行");
        put(55, "执行完毕");
    }};

    @Override
    protected void convert(BaseViewHolder helper, AlkData item) {
        TextView tv = helper.getView(R.id.label);
        if(StringUtils.isEmpty(item.getCaseType())){
            tv.setVisibility(View.GONE);
        }else{
            tv.setVisibility(View.VISIBLE);
            if("xgal".equals(item.getCaseType())){
                tv.setText("相关案例");
            }else{
                tv.setText("指导性案例");
            }
        }
        helper.setText(R.id.info,"地区："+StringUtils.toStringForWu(item.getDistrictName())+"    时间："+ TimeUtils.getTime(item.getCreateTime(),"yyyy-MM-dd"));
        TextView title = helper.getView(R.id.name);
        title.setText(StringUtils.delHtmlAllSigh(item.getCaseName()));
    }
}
